home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 187_01 / kbecho.c < prev    next >
Text File  |  1985-12-28  |  1KB  |  42 lines

  1. /*@*****************************************************/
  2. /*@                                                    */
  3. /*@ kbecho - collects characters from a keyboard input */
  4. /*@        routine, expands control chars to reverse   */
  5. /*@        video names, and writes them when a line    */
  6. /*@        is full.                                    */
  7. /*@                                                    */
  8. /*@   Usage:     kbecho(char);                         */
  9. /*@       where char is the char to be echoed.         */
  10. /*@                                                    */
  11. /*@*****************************************************/
  12.  
  13.  
  14. /***********************************************************************/
  15. /*                                       */
  16. /*    The following are specific for the IBM PC.               */
  17. /*                                       */
  18. /***********************************************************************/
  19.  
  20. #define     NORM    0x07    /* normal video attribute */
  21.  
  22. /***********************************************************************/
  23.  
  24. #define     EOS    0x00    /* end of string */
  25.  
  26. char strbuf[20];
  27. int  charcnt = 0;
  28.  
  29. kbecho(KbChar)
  30. char KbChar;
  31. {
  32.       int showch();
  33.  
  34.       charcnt += showch(KbChar);
  35.       if (charcnt >= 75) {
  36.       charcnt = 0;
  37.       strbuf[0] = '\n';
  38.       strbuf[1] = EOS;
  39.       conout(strbuf,NORM);
  40.        }
  41. }
  42.